/**
 * 
 */
package org.manekineko.regras;

import java.util.ArrayList;
import java.util.List;

/**
 * @author josen
 * 
 */
public class RegraNaoSequencial implements Regra {

	public void aplicar(List<Integer[]> p) {

		List<Integer[]> toRemoveList = new ArrayList<Integer[]>();

		for (int i = 0; i < p.size(); i++) {

			for (int k = 0; k < p.get(i).length; k++) {
				if ((k + 1) < p.get(i).length) {
					if ((p.get(i)[k] + 1) == (p.get(i)[k + 1])) {
						toRemoveList.add(p.get(i));
						break;
					}
				}
			}
		}

		p.removeAll(toRemoveList);
	}

	/**
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		RegraNaoSequencial rns = new RegraNaoSequencial();

		List<Integer[]> p = new ArrayList<Integer[]>();
		p.add(new Integer[] { 14, 24, 28, 37, 41, 49 });
		p.add(new Integer[] { 5, 33, 34, 43, 53, 54 });
		p.add(new Integer[] { 6, 16, 17, 21, 22, 35 });

		rns.aplicar(p);
		for (Integer[] dezenas : p) {
			for (int i = 0; i < dezenas.length; i++) {
				System.out.print(dezenas[i] + ",");
			}
		}
	}
}
